package crmsystem.com.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import crmsystem.com.entity.SaleexecutedataEntity;
import crmsystem.com.service.SaleexecutedataService;
import crmsystem.com.utils.PageUtils;
import crmsystem.com.utils.R;

import javax.validation.Valid;


/**
 * 
 *
 * @author zhugaowei
 * @email 1912431877@qq.com
 * @date 2021-01-07 12:48:11
 */
@RestController
@RequestMapping("/saleexecutedata")
public class SaleexecutedataController {
    @Autowired
    private SaleexecutedataService saleexecutedataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("com:saleexecutedata:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = saleexecutedataService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{eMonth}")
    //@RequiresPermissions("com:saleexecutedata:info")
    public R info(@PathVariable("eMonth") Integer eMonth){
		SaleexecutedataEntity saleexecutedata = saleexecutedataService.getById(eMonth);

        return R.ok().put("saleexecutedata", saleexecutedata);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("com:saleexecutedata:save")
    public R save(@Valid @RequestBody SaleexecutedataEntity saleexecutedata){
		saleexecutedataService.save(saleexecutedata);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("com:saleexecutedata:update")
    public R update(@Valid @RequestBody SaleexecutedataEntity saleexecutedata){
		saleexecutedataService.updateById(saleexecutedata);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("com:saleexecutedata:delete")
    public R delete(@RequestBody Integer[] eMonths){
		saleexecutedataService.removeByIds(Arrays.asList(eMonths));

        return R.ok();
    }

}
